<?php
/**
 * Created by JetBrains PhpStorm.
 * User: guansong
 * Date: 17/2/23
 * Time: 上午10:22
 * To change this template use File | Settings | File Templates.
 */

namespace app\admin\controller;


use app\admin\model\News;

class Index {
    public function index()
    {
       $news = new News();
        //关联预加载，可以减少数据库操作
       $data = $news->with("Comments")->select();//查询所有新闻
       return view("index",["data"=>$data]);
    }
}